#include "pch.h"
#include "InstanceDemo.h"
#include "Engine.h"
#include "Scene.h"

CInstanceDemo::CInstanceDemo()
{

}

CInstanceDemo::~CInstanceDemo()
{
}


void CInstanceDemo::init(mini::CEngine* pEngine)
{
	auto pActor = pEngine->getCurrentScene()->findActorByName("ground");
	if (nullptr != pActor && mini::EntityType::Instance == pActor->getEntityType())
	{
		auto pInstance = dynamic_cast<mini::CInstance*>(pActor);
		
		mini::Instance_P pos[2];
		pos[0].position.x = 0;
		pos[0].position.y = -6;
		pos[0].position.z = 60;

		pos[1].position.x = 0;
		pos[1].position.y = 1;
		pos[1].position.z = 60;
		
		pInstance->setInstanceData(&pos, sizeof(mini::Instance_P), countArray(pos));
	}
}


